package com.example.security.web;

import com.example.security.domain.User;
import com.example.security.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("login")
public class LoginController {


    private final UserService userService ;


    @GetMapping
    public PageInfo<User> list(@RequestParam(defaultValue = "1" ) int pageSize , @RequestParam(defaultValue = "10") int pageNum,User  user ){
        PageHelper.startPage(pageNum, pageSize);
        List<User> userList = userService.queryUserList(user);
        return new PageInfo<>(userList);

    }



}
